<div data-ng-include="'/themes/adminLTE/unl_data/pages/constant/header.html'" data-ng-controller="HeaderController">
</div>
<div class="wrapper">
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
   
      <!-- Content Header (Page header) -->
      <section class="content-header">
        <h1>
          用户管理
          <small>在这里可以管理用户的详细信息，注意：密码复位，新密码:1234</small>
        </h1>
        <ol class="breadcrumb">
			<li><a href="#/main"><i class="fa fa-home"></i></a></li>
			<li><i class="fa fa-wrench"></i> 管理</li>
			<li class="active"><i class="fa fa-group"></i> 用户管理</li>
        </ol>
      </section>

    <!-- Main content -->
<section class="content row">
<!-- /.content -->
<div class="col-xs-12">
	<div class="form-group">
	        <div class="input-group input-group-sm">
	                班级名<input type="text" placeholder="班级名"  data-ng-model="selclassname" style="border-radius:0px" ng-focus="selclassname='';">
	                比赛名<input type="text" placeholder="比赛名"  data-ng-model="selmatchname" style="border-radius:0px" ng-focus="selmatchname='';">
					
	                        <button type="button" class="btn btn-success " style="border-radius:0px" 
							 data-ng-click="selclass()">搜索</button>
	                        </span>
	       
	</div>
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">用户列表</h3>

              <div class="box-tools">
                <div class="btn-group">
                      <button type="button" class="btn btn-success btn-flat btn-sm" data-ng-click="openModal('adduser')" style="{{ (role == 'admin') ? '' : 'display:none'}}">+新建用户</button>
                      <div class="btn-group">
                        <button type="button" class="btn btn-default btn-flat btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                          更多信息 <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu pull-right dropdown-menu__column">
                          <li class="{{(sessionTime) ? 'active' : ''}}"><input id="check-time_id" type="checkbox" data-ng-click="sessionTime = !sessionTime" /><label class="pointer" for="check-time_id">最后登录时间</label>
                         </li>
                          <li class="{{(sessionIP) ? 'active' : ''}}"><input id="check-ip_id" type="checkbox" data-ng-click="sessionIP = !sessionIP"/><label for="check-ip_id" class="pointer"> 最后登录IP</label>
                          </li>
                          <li class="{{(currentFolder) ? 'active' : ''}}"><input id="check-folder_id" type="checkbox" data-ng-click="currentFolder = !currentFolder"><label for="check-folder_id" class="pointer"> 当前目录</label>
                          </li>
                          <li class="{{(currentLab) ? 'active' : ''}}"><input id="check-lab" type="checkbox" data-ng-click="currentLab = !currentLab"><label for="check-lab" class="pointer"> 当前 LAB</label>
                         </li>


                          <!-- <li class="{{(sessionTime) ? 'active' : ''}}"><a data-ng-click="sessionTime = !sessionTime" class="pointer">Last session time</a></li>
                          <li class="{{(sessionIP) ? 'active' : ''}}"><a data-ng-click="sessionIP = !sessionIP" class="pointer">Last session ip</a></li>
                          <li class="{{(currentFolder) ? 'active' : ''}}"><a data-ng-click="currentFolder = !currentFolder" class="pointer">Current folder</a></li>
                          <li class="{{(currentLab) ? 'active' : ''}}"><a data-ng-click="currentLab = !currentLab" class="pointer">Current lab</a></li> -->
                        </ul>
                      </div>
				</div>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover table-striped">
                <tbody><tr>
				  <th>序号</th>
                  <th>用户名</th>
                  <th>邮箱</th>
                  <th>名字</th>
				  <th>联系方式</th>
                  <th>角色</th>
				  <th>添加</th>
				  <th>编辑</th>
				  <th>删除</th>
				  <th>教师</th>
				  <th>学生</th>	
				  <th>比赛裁判</th>
				  <th>参赛选手</th>	
                  <th data-ng-show="sessionTime">最后登录时间</th>
                  <th data-ng-show="sessionIP">最后登录IP</th>
                  <th data-ng-show="currentFolder">当前目录</th>
                  <th data-ng-show="currentLab">当前 Lab</th>                  
                  <th>操作</th>
                </tr>
                <tr data-ng-repeat="(x,y) in userdata">
					<td>{{y.id}}</td>
					<td>{{x}}</td>
					<td>{{y.email}}</td>
					<td>{{y.name}}</td>
					<td>{{y.lianxi}}</td>
					<td>{{y.role}}</td>
					<td><input type="checkbox" 
    ng-checked="isChecked(y.addqx)" ng-click="updateSelection($event,y.username,'addqx')"
ng-disabled="{{ (role == 'admin') ? false : true}}"
></td>
					<td><input type="checkbox" ng-model="y.editorqx" 
    ng-checked="isChecked(y.editorqx)" ng-click="updateSelection($event,y.username,'editorqx')" 
ng-disabled="{{ (role == 'admin') ? false : true}}"
></td>
					<td><input type="checkbox" ng-model="y.delqx" 
    ng-checked="isChecked(y.delqx)" ng-click="updateSelection($event,y.username,'delqx')" 
ng-disabled="{{ (role == 'admin') ? false : true}}"></td>
<td>{{y.classteacher}}</td>
<td>{{y.classstudent}}</td>
<td>{{y.matchreferee}}</td>
<td>{{y.matchplayer}}</td>					
					<td data-ng-show="sessionTime">{{ (y.session  === null ) ? 'N/A' : timeConverter(y.session) }}</td>
					<td data-ng-show="sessionIP">{{ (y.ip === null) ? 'N/A' : y.ip}}</td>
					<td data-ng-show="currentFolder">{{ (y.folder  === null) ? 'N/A' : y.folder }}</td>
					<td data-ng-show="currentLab">{{ (y.lab  === null) ? 'N/A' : y.lab }}</td>					
					<td>
                      <button type="button" class="btn btn-default btn-flat btn-xs" data-ng-click="openModal('edituser2', y.username);" style="{{ (role == 'admin') ? '' : 'display:none'}}"><i class="fa fa-edit"></i> 编辑</button>
                      <button type="button" class="btn btn-danger btn-flat btn-xs" data-ng-click="deleteUser( y.username )" style="{{ (role == 'admin') ? '' : 'display:none'}}"> <i class="fa fa-trash-o"></i></button>
					  <button type="button" class="btn btn-danger btn-flat btn-xs" data-ng-click="resetpass( y.username )" style="{{ (role == 'admin') ? '' : 'display:none'}}"> 密码复位</button>
					</td>
                </tr>
              </tbody></table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
<!-- /.content -->
</section>
  </div>
  <!-- /.content-wrapper -->
  
  
  <!-- Main Footer -->
  <!-- <div data-ng-include="'/themes/adminLTE/unl_data/pages/constant/footer.html'"> -->
</div>
<!-- ./wrapper -->
<!-- AdminLTE App -->
<link rel="stylesheet" href="/themes/adminLTE/dist/css/skins/skin-blue.min.css">
<script src="/themes/adminLTE/dist/js/app.js"></script>
